import {HTTP} from '../utils/http'

class orderCenterModel extends HTTP{
  // 订单列表
  orderList(current,size,type){
    return this.request({
      url: 'order/getOrderList',
      data: {
        'current': current || 1,
        'size': size || 10,
        'type': type || 0
      }
    })
  };
  // 售后列表
  afterSaleList(current,size){
    return this.request({
      url: 'order/afterSale/afterSaleList',
      data: {
        'current': current || 1,
        'size': size || 10
      }
    })
  };
  // 取消订单
  cancelOrder(orderId){
    return this.request({
      url: 'order/cancelOrder',
      data: {
        'orderId': orderId
      }
    })
  };
  // 退款/申请售后
  refundOrder(orderId,type,commodityId,cause){
    return this.request({
      url: 'order/afterSale/apply',
      data: {
        'orderId': orderId,
        'type': type || 0,
        'commodityId': commodityId,
        'cause':cause || ''
      }
    })
  };
  // 确认收货
  confirm(orderId){
    return this.request({
      url: 'order/confirmReceipt',
      data: {
        'orderId': orderId
      }
    })
  };
}
export {orderCenterModel}
